
// Copyright (c) 2002 HTHK
package admin.system.func;

import com.ffpc.sql.*;

import java.sql.*;
import java.util.Vector;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class FuncProcess
{
    public static FuncBean createBean()
    {
        return new Func();
    }

    public static int insert(Connection con, FuncBean funcBean)
      throws DataException
    {
        Func func = (Func)funcBean;
        func.setConnection(con);
        return func.insert();
    }

    public static int update(Connection con, FuncBean funcBean)
      throws DataException
    {
        Func func = (Func)funcBean;
        func.setConnection(con);
        return func.update();
    }

    public static int delete(Connection con, FuncBean funcBean)
      throws DataException
    {
        Func func = (Func)funcBean;
        func.setConnection(con);
        return func.delete();
    }

    public static FuncBean[] find(Connection con, FuncBean funcBean)
      throws DataException
    {
        Func func = (Func)funcBean;
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(func);
        FuncBean[] beans = new Func[rows.size()];
        for (int i=0;i<rows.size();i++)
        {
            Func bean = new Func();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        }
        return beans;
    }
}


